home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cdrecord-1.8.1 / lib / getfp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-11  |  1.5 KB  |  66 lines

  1. /* @(#)getfp.c    1.9 99/09/11 Copyright 1988 J. Schilling */
  2. /*
  3.  *    Get frame pointer
  4.  *
  5.  *    Copyright (c) 1988 J. Schilling
  6.  */
  7. /*
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 2, or (at your option)
  11.  * any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; see the file COPYING.  If not, write to
  20.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. #include <mconfig.h>
  24. #include <standard.h>
  25.  
  26. #ifdef    NO_SCANSTACK
  27. #    ifdef    HAVE_SCANSTACK
  28. #    undef    HAVE_SCANSTACK
  29. #    endif
  30. #endif
  31.  
  32. #ifdef    HAVE_SCANSTACK
  33. #include <stkframe.h>
  34.  
  35. #define    MAXWINDOWS    32
  36. #define    NWINDOWS    7
  37.  
  38. #if defined(sparc) && defined(__GNUC__)
  39. #    define    IDX        3    /* some strange things on sparc gcc */
  40. #else
  41. #    define    IDX        1
  42. #endif
  43.  
  44. void **getfp()
  45. {
  46.         long    **dummy[1];
  47.     static    int    idx = IDX;    /* fool optimizer in c compiler */
  48.  
  49. #ifdef    sparc
  50.     flush_reg_windows(MAXWINDOWS-2);
  51. #endif
  52.     return ((void **)((struct frame *)&dummy[idx])->fr_savfp);
  53. }
  54.  
  55. #ifdef    sparc
  56. int flush_reg_windows(n)
  57.     int    n;
  58. {
  59.     if (--n > 0)
  60.         flush_reg_windows(n);
  61.     return (0);
  62. }
  63. #endif
  64.  
  65. #endif    /* HAVE_SCANSTACK */
  66.